<?php
class Khoahoc extends Vnf_Db_Table {
    protected $_name;
    protected $_primary = 'khoahoc_id';

    function __construct() {
        $this->_name = DB_PREFIX . "khoahoc";
        parent::__construct();
    }
	
    public function getColumns() {
        $results = array('khoahoc_id', 'khoahoc_name', 'khoahoc_summary', 'khoahoc_info', 'khoahoc_active', 'khoahoc_datecreate', 'khoahoc_file');
        return $results;
    }

    public function getPrimaryKey() {
        $pk = $this->_primary;
        if (is_array($pk)) {
            if (count($pk) > 0)
                return $pk[1]; // array[1] contain column name of primary key
        }
        return $this->_primary;
    }
    public function getkhoahoc(){
    	$select = Zend_Db_Table_Abstract::select();
        $select->setIntegrityCheck(false);
        $select->from(array('a' => $this->_name));
        $select->where('khoahoc_active = ?', 1);
        $data = $this->fetchAll($select);
        if ($data) {
            return $data->toArray();
        }
        return $data;
    }
 	public function getById($id){
    	$select = Zend_Db_Table_Abstract::select();
        $select->setIntegrityCheck(false);
        $select->from(array('a' => $this->_name));
        $select->where('khoahoc_active = ?', 1);
         $select->where('khoahoc_id = ?', $id);
        $data = $this->fetchAll($select);
        if ($data) {
            return $data->toArray();
        }
        return $data;
    }
	public function getOther($id){
    	$select = Zend_Db_Table_Abstract::select();
        $select->setIntegrityCheck(false);
        $select->from(array('a' => $this->_name));
        $select->where('khoahoc_active = ?', 1);
         $select->where('khoahoc_id != ?', $id);
        $data = $this->fetchAll($select);
        if ($data) {
            return $data->toArray();
        }
        return $data;
    }
}
?>
